import grapefruit
from PIL import Image

def read(filename):
	lines = open(filename, "r").readlines()
	size = map(lambda x: int(x), lines[1].split())
	
	im = Image.new("RGB", size)
	im.format = "PPM"
	pix = im.load()
	
	for i in range(size[0]):
		for j in range(size[1]):
			pix[i,j] = tuple(map(lambda x: int(x), lines[j * size[0] + i + 3].split()))
	return im

def testRead():
	im = read("../asst2io/inpainting_clean.ppm")
	im.show()
	im.save("output.png")
